from coordinate_convert.convert import wgs84_to_web_mercator, web_mercator_to_tile_no
from tile_downloading.download import download_tiles
def get_tiles(topLeft, bottomRight,zoom):
    wm_topleft = wgs84_to_web_mercator(topLeft[0], topLeft[1])
    wm_bottomRight = wgs84_to_web_mercator(bottomRight[0], bottomRight[1])

    tile_topleft = web_mercator_to_tile_no(wm_topleft[0],wm_topleft[1], zoom)
    tile_bootomRight = web_mercator_to_tile_no(wm_bottomRight[0], wm_bottomRight[1], zoom)

    download_tiles(16, range(tile_topleft[0], tile_topleft[1]),range(tile_bootomRight[0], tile_bootomRight[1]), 'tiles')




if __name__ == "__main__":
    get_tiles([119.5,35.5], [119.55,35.45], 16)